#include <cmath>
#include <vector>
#include <iostream>
#include <vector>
#ifdef WIN32
#include <glew.h>
#include <glut.h>
#else
#include <GL/glew.h>
#include <GL/glut.h>
#endif

#include "draw.h"
#include "mesh.h"

float randreal()
{
	return (float(rand()% 32768)/float(32767));
}

void drawsphere(float x, float y, float z, float radius) 
{
	glTranslatef(x ,y,z);
	glutSolidSphere(radius,10,10);
	glTranslatef(- x , -y, -z);
}
void getGLVersion(int * major, int * minor)
{
	const char * verstr = (const char *) glGetString (GL_VERSION) ;
	if ((verstr == NULL) || (sscanf(verstr, "%d.%d", major, minor) != 2))
	{
		* major = * minor = 0;
		fprintf(stderr, "Invalid GL_VERSION format!!! \n");
	}
}
void getGLSLVerstion(int * major, int * minor)
{
	int gl_major, gl_minor;
	getGLVersion(& gl_major, &gl_minor);
	if (gl_major >= 2)
	{
		const char * verstr = (const char *) glGetString (GL_SHADING_LANGUAGE_VERSION);
		if ((verstr == NULL) || (sscanf(verstr, "%d.%d", major, minor) != 2))
		{	
			* major = * minor = 0;
			fprintf(stderr, "Invalid GL_VERSION format!!! \n");
		}
	}
}
